#ifndef RPCCALL_H
#define RPCCALL_H

#include <Resource.h>
#include <ProcessManager.h>

class RpcCall
{
public:
  union CallCollection
  {
    Resource::Call0 call0;
    Resource::Call1 call1;
    Resource::Call2 call2;
    Resource::Call3 call3;
    Resource::Call4 call4;
    Resource::Call5 call5;
  };
  
  RpcCall(Callable *obj, int p1=0, int p2=0,
          int p3=0, int p4=0, int p5=0) :
    obj(obj), p1(p1), p2(p2), p3(p3), p4(p4), p5(p5)
  {
    complete = false;
    destroyable = false;
    sender = processManager->getProcess()->getPid();
  }
  
  bool isComplete()
  {
    return complete;
  }
  
  Callable *obj; // object to call.
  CallCollection call; // Function to call.
  int nparams; // Index into union as to which function prototype to use.
  int p1, p2, p3, p4, p5; // Parameters
  int r; // Return value
  unsigned int eax, ebx, ecx, edx, esi, edi; // Contents of saved registers.
  unsigned int eip, eflags;
  bool complete;
  int sender;
  bool destroyable;
};

#endif
